package com.party.admin.biz.notify;

import com.party.admin.web.dto.input.common.CommonQuery;
import com.party.common.paging.Page;
import com.party.core.model.notify.InstanceWithMember;
import com.party.core.service.notify.IInstanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 消息业务服务接口
 * Created by wei.li
 *
 * @date 2017/8/3 0003
 * @time 11:52
 */

@Service
public class MessageBizService {

    @Autowired
    private IInstanceService instanceService;


    /**
     * 短信列表
     *
     * @param instanceWithMember 短信
     * @param page 分页参数
     * @return 短信列表
     */
    public List<InstanceWithMember> list(InstanceWithMember instanceWithMember, Page page){

        if (null != instanceWithMember.getTimeType() && !new Integer(0).equals(instanceWithMember.getTimeType())) {
            CommonQuery commonQuery = new CommonQuery();
            commonQuery.setTimeType(instanceWithMember.getTimeType());
            instanceWithMember.setCreateStart(commonQuery.getCreateStart());
            instanceWithMember.setCreateEnd(commonQuery.getCreateEnd());
        }

        List<InstanceWithMember> list = instanceService.listWithMemberPage(instanceWithMember, page);
        return list;
    }
}
